<link href="../html/css/site.css" rel="stylesheet" type="text/css" />
<?php
require_once("db_connection.php");
$id = isset($_GET['id']) ? $_GET['id'] : 0;
$product = fetchById('products',$id);
pr($product);

$isActive = $product['status']==1?'checked':'';
$isInactive = $product['status']==0?'checked':'';
?>
<form action="edit_save_product.php"  enctype="multipart/form-data"  method="post">

<input type="hidden" name="id" value="<?=$product['id']?>" />

  <table border="0" width="80%" align="center"cellspacing ="0">
    <thead>
      <tr>
        <th colspan="2">::Edit Product Details::</th>
      </tr>
    </thead>
    <tbody>

      <tr>
        <td align="right">Product Name :</td>
        <td><input type="text" name="name" required value="<?=$product['name']?>" /></td>
      </tr>

      <tr>
        <td align="right">Product Image :</td>
        <td><input type="file"  name="image" required value="" /><img src="p_images/<?=$product['image']?>"height="90" width="120"></td>
      </tr>

      <tr>
        <td align="right">Product Category</td>
        <td>
<?=displaySelectCategories('category_id',$product['category_id'])?>

          </td>
      </tr>

      <tr>
        <td align="right">Product Amount :</td>
        <td><input type="text" maxlength="6" required  autocomplete="off" name="amount" value="<?=$product['amount']?>" /></td>
      </tr>

      <tr>
        <td align="right">Status</td>
        <td>
<label><input type="radio" name="status" value="1" <?=$isActive?> />Active</label>
<label><input type="radio" name="status" value="0" <?=$isInactive?> />Inactive</label>
         </td>
      </tr>

      <tr>
        <td align="right">&nbsp;</td>
        <td><input type="submit" value="Edit Product"> </td>
      </tr>

    </tbody>
  </table>

</form>


